package com.tbocek.android.ode.systems.loktavolterra;

import com.tbocek.android.ode.solver.SystemState;

/**
 * System state for Lokta-Volterra equations.
 * @author Tim
 *
 */
public class LoktaVolterraState extends SystemState {
	
	/**
	 * Constructor.
	 */
	public LoktaVolterraState() {
		super(2);
	}
	
	/**
	 * Creates an array containing the derivatives of the system variables.
	 * @param predatorDerivative Derivative of the number of predators at the
	 * 		current time.
	 * @param preyDerivative Derivative of the number of prey at the
	 * 		current time.
	 * @return Array containing the derivatives in the correct locations.
	 */
	public static float[] createDerivativeArray(
			float predatorDerivative, float preyDerivative) {
		return new float[] {predatorDerivative, preyDerivative};
	}
	
	/**
	 * @return Current number of predators.
	 */
	public float getPredatorCount() {
		return mVariables.get(0);
	}
	
	/**
	 * @return Current number of prey.
	 */
	public float getPreyCount() {
		return mVariables.get(1);
	}
	
	protected SystemState emptyClone() {
		return new LoktaVolterraState();
	}
}
